/*
 * @Description: 
 * @Autor: ilmari
 * @Date: 2021-04-29 10:18:26
 * @LastEditors: ilmari
 * @LastEditTime: 2021-05-08 13:32:24
 */
import 'package:flutter/material.dart';
import 'package:rcmd/app/resource/dimens.dart';
import 'package:rcmd/app/resource/resource_colors.dart';

class AppTheme {
  final String name;
  final ThemeData data;

  AppTheme(this.name, this.data);
}

AppTheme lightTheme = AppTheme('Light', ThemeData.light());
AppTheme darkTheme = AppTheme('Dark', ThemeData.dark());
AppTheme customTheme = AppTheme('Custom', _buildCustomTheme());
List<AppTheme> appThemes = [lightTheme, darkTheme, customTheme];
//设置默认的主题
ThemeData _buildCustomTheme() {
  final ThemeData base = ThemeData.dark();
  return base.copyWith(
      buttonTheme: base.buttonTheme.copyWith(
        buttonColor: Colors.red,
        disabledColor: Colors.red,
        focusColor: Colors.red,
        hoverColor: Colors.red,
        highlightColor: Colors.red,
        splashColor: Colors.red,
        colorScheme: base.buttonTheme.colorScheme?.copyWith(
          background: base.colorScheme.background
        ),
      ));
}

// shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))),
TextTheme _buildPrimaryTextTheme(TextTheme base) {
  return base.apply(fontFamily: 'PingFang SC');
}

TextTheme _buildAccentTextTheme(TextTheme base) {
  return base.apply(fontFamily: 'PingFang SC');
}

IconThemeData _buildPrimaryIconTheme(IconThemeData base) {
  return base.copyWith();
}

TextTheme _buildTextTheme(TextTheme base) {
  return base
      .copyWith(
        button: TextStyle(fontWeight: FontWeight.normal),
        subtitle1: base.subtitle1?.copyWith(
            textBaseline: TextBaseline.alphabetic, fontSize: DimenFont.sp40),
        // 修复 textfield hint text 不对齐
        subtitle2:
            base.subtitle2?.copyWith(textBaseline: TextBaseline.alphabetic),
      )
      .apply(fontFamily: 'PingFang SC');
}

_buildTypographyTheme(Typography typography) {
  return typography.copyWith();
}
